<template>
  <div>
    <Header />
    <Banner :sightName="sightName" :bannerImg="bannerImg" :gallaryImgs="gallaryImgs" />
    <div class="content">
      <List :list="list" />
    </div>
  </div>
</template>

<script>
import Banner from './components/Banner.vue'
import Header from './components/Header.vue'
import List from './components/List.vue'

import { get } from '../../utils/http'

export default {
  name: 'Detail',

  components: {
    Banner,
    Header,
    List,
  },
  data() {
    return {
      list: [],
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
    }
  },

  methods: {
    getDetailData() {
      get(`/api/detail.json?id=${this.$route.params.id}`).then(this.hdGetDetailDataSucc) // 获取数据
    },
    hdGetDetailDataSucc(res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        // console.log(data)
        this.sightName = data.sightName
        this.gallaryImgs = data.gallaryImgs
        this.bannerImg = data.bannerImg
        this.list = data.categoryList
      }
    },
  },

  mounted() {
    this.getDetailData()
  },
}
</script>

<style lang="scss" scoped></style>
